import http from '@/common/utils/http'
import { defineStore } from 'pinia'

interface UploadState {
  fileDomain: Record<string, unknown>
}
export default defineStore('upload', {
  state: () =>
    ({
      fileDomain: {
        cos7moorBusinessDomain: 'https://cc-business-cos.7moor.com/',
        cos7moorCommonDomain: 'https://cc-common-cos.7moor.com/',
        cos7moorEmailDomain: 'https://cc-im-kefu-cos.7moor-fs1.com/',
        cos7moorImDomain: 'https://cc-im-kefu-cos.7moor-fs1.com/',
        cos7moorKmDomain: 'https://cc-km-cos.7moor.com/',
        cos7moorTestDomain: 'https://cc-kf-dev-cos.7moor.com/',
        qiniuUploadDomain: 'https://upload.qiniup.com/'
      }
    } as UploadState),
  getters: {},
  actions: {
    getFileDomain(data: any) {
      const req = {
        data,
        action: 'common.getFileDomain'
      }
      return http({
        method: 'POST',
        data: req
      })
    }
  }
})
